package com.quanjiaolian.findins.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.quanjiaolian.findins.service.FindInsService;
import com.quanjiaolian.findins.serviceimpl.FindInsServiceImpl;
import com.quanjiaolian.tools.ResponseToJson;

@SuppressWarnings("serial")
public class InsDetail extends HttpServlet {

	/**
	 * 声明Log4j变量
	 */
	public static ResourceBundle resourceBundle = null;
	static Logger logger = Logger.getLogger(InsDetail.class.getName());
	
	Map<String,Object> resultMap = new HashMap<String,Object>();
	FindInsService fis = new FindInsServiceImpl();
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		try{
			String ins_id = request.getParameter("ins_id");
			List<Object> list = fis.queryInsDetail(Integer.parseInt(ins_id));
			if(list != null && list.size()>0){
				resultMap.put("result",list);
			}else{
				resultMap.put("result","Failed");
			}
		}catch (Exception e) {
			resultMap.put("result","Error");
			logger.info(e);
		}
		ResponseToJson.responseOutWithJson(response, resultMap);
		
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
